UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MyXM1k1iHdhwIVmMaRREIhKlYREjWog8Vtj6KL1FXa0='
WHERE
key_id = '97460e500089307a83b9c9992fa3c6312cc7265dd263556208a35a552cedb9ae'
AND (
token = 'MyXM1k1iHdhwIVmMaRREIhKlYREjWog8Vtj6KL1FXa0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)