UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jJN77w5kTIx9Xw6I7DxooF7o/nJJ+yOmtPl0reCLnKA=' 
WHERE 
  key_id = 'd5d3d0906c6b5dac341d4b3feed4e7185c2fab688215e2b1f44e038177042a52' 
  AND (
    token = 'jJN77w5kTIx9Xw6I7DxooF7o/nJJ+yOmtPl0reCLnKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027