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