UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qe+mfJI1UtIWRXbHfqwWg+NjZtOYfv5zBgUFxf8o880=' 
WHERE 
  key_id = '21795805fb96d122e971deb27c0a38dbc24bf9ded1cdc5a58adf484016f822f5' 
  AND (
    token = 'qe+mfJI1UtIWRXbHfqwWg+NjZtOYfv5zBgUFxf8o880=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032