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