UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xS8W1VMPaVb1KcOJY4dYL1YjE2tMZAbjrRRc8AJK+qE='
WHERE
key_id = 'cd2a601c6aa102b85b6e5820b2b3633c02d2ba30c5e55aa81abe75713473e6d9'
AND (
token = 'xS8W1VMPaVb1KcOJY4dYL1YjE2tMZAbjrRRc8AJK+qE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)