UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KVmMZRj/QHZ1rDtQXpW9dAhhGGOJnw6Iq5ru5kAE7eQ='
WHERE
key_id = '58314e30feb3b44cfc51035f7be5aeecd44da830fe997ec226f5ad1e618eaa14'
AND (
token = 'KVmMZRj/QHZ1rDtQXpW9dAhhGGOJnw6Iq5ru5kAE7eQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)