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