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