UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '81670o8cdlfAI8koZHFAU2qTH4W68g70teWhGxqLkYY='
WHERE
key_id = 'd0c6d49537c78d78db51d73120b5d70f236204f17895cbbe2f9a242232b870f7'
AND (
token = '81670o8cdlfAI8koZHFAU2qTH4W68g70teWhGxqLkYY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)