UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gJYWU0ZrZ2r1dRUVTXicAtfPecisLufwJtREFjAA+cQ='
WHERE
key_id = '37aee8fa7ff17c196c515fea041c7569753a405fa1cb6a4bdbddf33cee4cf8cd'
AND (
token = 'gJYWU0ZrZ2r1dRUVTXicAtfPecisLufwJtREFjAA+cQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)