UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sJPinu8a8Oy0mmqp+9n17P46fF7Yk5A2WYL93XjuORg='
WHERE
key_id = '552613122a9eff715e70d804e3280f626ed6f5b424f5a839050d352a4f58b38d'
AND (
token = 'sJPinu8a8Oy0mmqp+9n17P46fF7Yk5A2WYL93XjuORg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)