UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SDjm5ab3TTU5/V9n0JLeaNrtqAZ8KncBIrJ5dvWGLEs='
WHERE
key_id = '590e8fca9a2dcd54413e35025303d6c956fe794f65501a1b728198d0e26f45ca'
AND (
token = 'SDjm5ab3TTU5/V9n0JLeaNrtqAZ8KncBIrJ5dvWGLEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)