UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8qwBtObaKv8sidRcwrsprTSYLQDbgnGIEqz43CodXmk=' 
WHERE 
  key_id = '79d4ece40b7ce35eecf5d8fd279a82fc6f5929a9fb4eb2febbd4ff2f46ff4cd6' 
  AND (
    token = '8qwBtObaKv8sidRcwrsprTSYLQDbgnGIEqz43CodXmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038