UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nn72SvO6Eo4jTvFJr9xXf3K8TM7ow2DCdmh7/CBW6Kg='
WHERE
key_id = 'd74cccdf22f55656fd9a893e092254cad3463b845d111d3dd584278a4dfb22a5'
AND (
token = 'nn72SvO6Eo4jTvFJr9xXf3K8TM7ow2DCdmh7/CBW6Kg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)