UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q7if625HP0dmIUQM6XT9hgd4ZSNb4APPlug8VIzvBi0='
WHERE
key_id = '7c54f9dde12a19c6e97a3e8ba740f89c8963c091b4ee7d57ab3f29a5fc3b9e64'
AND (
token = 'q7if625HP0dmIUQM6XT9hgd4ZSNb4APPlug8VIzvBi0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)