UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dEjWvoDIWIwvtgtv2Z02lEB1uXUZqoXfPUigY60PYOc='
WHERE
key_id = '3888cb807c1e17bbe504e386d28c797da9e0cbd7c2166d9585af9d7e73f4c4ef'
AND (
token = 'dEjWvoDIWIwvtgtv2Z02lEB1uXUZqoXfPUigY60PYOc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)