UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QZ/yVwI0UqdefGQZUYU/At3Nt2f1kSUQftGGNv8kbaA='
WHERE
key_id = 'e1caa05959ad835ea7645be6cc35fba7b4c52945d7d33c2b6fc536ed3de51bad'
AND (
token = 'QZ/yVwI0UqdefGQZUYU/At3Nt2f1kSUQftGGNv8kbaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)