UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wSfgASahIuYkTVfjuTK7vVoiejjtWu6w0aRDRNcMj28='
WHERE
key_id = 'daf8b05fbc19574a7757ce8c28c9df0ec38cd6852f4e15ea56cac51e6dda05f4'
AND (
token = 'wSfgASahIuYkTVfjuTK7vVoiejjtWu6w0aRDRNcMj28='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)