UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '59G7HhHRh8OHCytTVeVy5Tcjqb1Fmw0K5LAsmtGQD4s='
WHERE
key_id = 'd2ed3ce99e5568899114ead7f73dbdc754795b245b83ee29db3fe81917cd980f'
AND (
token = '59G7HhHRh8OHCytTVeVy5Tcjqb1Fmw0K5LAsmtGQD4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)