UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tNspw719n3HG4iBKnUIftAL0IjhIxaPhsCLEtF3zriY=' 
WHERE 
  key_id = 'b31a92b1596a52ed019ac33646aab594dd8203f3d08afdf094fdc5a92a86bbca' 
  AND (
    token = 'tNspw719n3HG4iBKnUIftAL0IjhIxaPhsCLEtF3zriY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039