UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nOIbjcxo2ElRTna5PPozFJkJNKW9DFRYC4rZY1JBjHQ='
WHERE
key_id = '8d24ac87a97669f2190608bffd76344cb047e832c8f16d4bed84e7df9166d796'
AND (
token = 'nOIbjcxo2ElRTna5PPozFJkJNKW9DFRYC4rZY1JBjHQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)