UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XUeiJn5n9zJ+t2pGkCPJwUHqNIC0QU7jQayi8ydnUkw='
WHERE
key_id = '724477ec27415523e9b3eff42cb593e090fad969a834fd9a9f37c3c9aaacc0f5'
AND (
token = 'XUeiJn5n9zJ+t2pGkCPJwUHqNIC0QU7jQayi8ydnUkw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)