UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S8+hoSFoc+vWJa74CRjI5FQGAtBG4fDnRTlAc5vildE='
WHERE
key_id = '175001d867a65fb70a4dad5dda629f4df27251735897a59b072bdfd3a5f48629'
AND (
token = 'S8+hoSFoc+vWJa74CRjI5FQGAtBG4fDnRTlAc5vildE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)