UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lgixy+Sf0fPEZTTJosQ1phx1ipo7qullBtQ1LNxfQ/w=' 
WHERE 
  key_id = '504882f0860971f69e7a88cc3f9d4408baad64e3d6f765f148225deeb5429018' 
  AND (
    token = 'Lgixy+Sf0fPEZTTJosQ1phx1ipo7qullBtQ1LNxfQ/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035