UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g93/BViv3+vKpQkx+cFaROFW+zfh5OkOjix2bviREeU=' 
WHERE 
  key_id = 'b30dccd6a79477d971d2fb743407d377b57924a1b1fb09e7e96b18032831b54f' 
  AND (
    token = 'g93/BViv3+vKpQkx+cFaROFW+zfh5OkOjix2bviREeU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036