UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NtJaw12jqKLmmtQyfgv4BwQTts3eXnHD0ZC4Hze4oLI='
WHERE
key_id = 'a46aede1cc0f8e82d5dd310a9fb72709c12cff1e2820a8d67728fe9abc54b61e'
AND (
token = 'NtJaw12jqKLmmtQyfgv4BwQTts3eXnHD0ZC4Hze4oLI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)