UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kmgnrsb6pO7IU9J8o/+OgDn/gEELX2x5nNf9DbakWjU='
WHERE
key_id = 'b3574730e4048c0fcbd999394de82ce14ed6f749eb48853291e4c0f6f7a59321'
AND (
token = 'Kmgnrsb6pO7IU9J8o/+OgDn/gEELX2x5nNf9DbakWjU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)