UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uO637BNVM3SrwPdQe/K9SUk18+l+JSGy+2uUltJDz48='
WHERE
key_id = 'e8cffecdc96701f00adba4b9dfd0130f3253c64e892a2f045bcca9bf405deb05'
AND (
token = 'uO637BNVM3SrwPdQe/K9SUk18+l+JSGy+2uUltJDz48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)