UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wftmY4pVRa7ocplvWrGyo4jEJSYgRqPLljoEeezCid8='
WHERE
key_id = '47585ebbe9517f5213599423f19e7d8cbdffc02d8d39dc7d1881e7c76b5ff09d'
AND (
token = 'wftmY4pVRa7ocplvWrGyo4jEJSYgRqPLljoEeezCid8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)