UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1lGCSqOJ8KiglWQVlvXWDsLbfVk1tVsonlxzy1dkPDQ='
WHERE
key_id = 'adac7ba34b3a865646ad59e92d49c589e9354f23fe77214d426d1cddb92c2098'
AND (
token = '1lGCSqOJ8KiglWQVlvXWDsLbfVk1tVsonlxzy1dkPDQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)