UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '00iqd3C80L3tCZSyvaQZ4JVGEWopGPsPwuiCA7xNLIE='
WHERE
key_id = '76c253809ac2bbadf625d0ea7ee7ed4d6038fcfdb0c31ddfd658e1b072b94618'
AND (
token = '00iqd3C80L3tCZSyvaQZ4JVGEWopGPsPwuiCA7xNLIE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)