UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd9teAyLfapER749RgEnihDU1ik8r1qxzDYYl99p4OOE='
WHERE
key_id = '636c3735778e88e830b8ec5eaffe9e688b8bcd614ecb7c68dbf127b8c6f4fff2'
AND (
token = 'd9teAyLfapER749RgEnihDU1ik8r1qxzDYYl99p4OOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)